package com.smile.f315;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.CubicCurve2D;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import javax.swing.JFrame;
import javax.swing.JPanel;
class PaintPanel extends JPanel{
	public void paintComponent(Graphics g){
		super.paintComponents(g);
		Graphics2D g2 = (Graphics2D)g;
		//Point2D.Double begin = new Point2D.Double(10.0, 20.0);
		//Point2D.Double end = new Point2D.Double(200.0, 80.0);
		//Line2D.Double line = new Line2D.Double(begin,end);
		CubicCurve2D c = new CubicCurve2D.Double();
		c.setCurve(10.0, 20.0, 60.0, 70.0, 100.0, 10.0, 200.0, 80.0);
		g2.draw(c);
	}
}
public class LineDemo {
	public void createUI(){
		JFrame frame = new JFrame("绘制直线示例程序");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		PaintPanel panel = new PaintPanel();
		frame.add(panel);
		
		frame.setBounds(200, 200, 250, 120);
		frame.setVisible(true);
	}
	public static void main(String[] args) {
		LineDemo example = new LineDemo();
		example.createUI();
	}
}